home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_xemacs.idb / usr / freeware / lib / xemacs-20.4 / lisp / modes / autoconf-mode.el.z / autoconf-mode.el
Encoding:
Text File  |  1998-05-21  |  3.3 KB  |  84 lines

  1. ;;; autoconf-mode.el --- autoconf code editing commands for Emacs
  2.  
  3. ;; Author: Martin Buchholz (mrb@eng.sun.com)
  4. ;; Maintainer: Martin Buchholz
  5. ;; Keywords: languages, faces, m4, configure
  6.  
  7. ;; This file is part of XEmacs
  8.  
  9. ;; XEmacs is free software; you can redistribute it and/or modify it
  10. ;; under the terms of the GNU General Public License as published by
  11. ;; the Free Software Foundation; either version 2, or (at your option)
  12. ;; any later version.
  13.  
  14. ;; XEmacs is distributed in the hope that it will be useful, but
  15. ;; WITHOUT ANY WARRANTY; without even the implied warranty of
  16. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  17. ;; General Public License for more details.
  18.  
  19. ;; You should have received a copy of the GNU General Public License
  20. ;; along with XEmacs; see the file COPYING.  If not, write to the Free
  21. ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  22. ;; 02111-1307, USA.
  23.  
  24. ;;; Synched up with: not in FSF.
  25.  
  26. ;;; Commentary:
  27.  
  28. ;; A major mode for editing autoconf input (like configure.in).
  29. ;; Derived from m4-mode.el by Andrew Csillag (drew@staff.prodigy.com)
  30.  
  31. ;;; Code:
  32.  
  33. ;;thank god for make-regexp.el!
  34. (defvar autoconf-font-lock-keywords
  35.   `(("\\bdnl \\(.*\\)"  1 font-lock-comment-face t)
  36.     ("\\$[0-9*#@]" . font-lock-variable-name-face)
  37.     ("\\b\\(m4_\\)?\\(builtin\\|change\\(com\\|quote\\|word\\)\\|d\\(e\\(bug\\(file\\|mode\\)\\|cr\\|f\\(ine\\|n\\)\\)\\|iv\\(ert\\|num\\)\\|nl\\|umpdef\\)\\|e\\(rrprint\\|syscmd\\|val\\)\\|f\\(ile\\|ormat\\)\\|gnu\\|i\\(f\\(def\\|else\\)\\|n\\(c\\(lude\\|r\\)\\|d\\(ex\\|ir\\)\\)\\)\\|l\\(en\\|ine\\)\\|m\\(4\\(exit\\|wrap\\)\\|aketemp\\)\\|p\\(atsubst\\|opdef\\|ushdef\\)\\|regexp\\|s\\(hift\\|include\\|ubstr\\|ys\\(cmd\\|val\\)\\)\\|tra\\(ceo\\(ff\\|n\\)\\|nslit\\)\\|un\\(d\\(efine\\|ivert\\)\\|ix\\)\\)\\b" . font-lock-keyword-face)
  38.     "default font-lock-keywords")
  39. )
  40.  
  41. (defvar autoconf-mode-syntax-table nil
  42.   "syntax table used in autoconf mode")
  43. (setq autoconf-mode-syntax-table (make-syntax-table))
  44. (modify-syntax-entry ?\" "\""  autoconf-mode-syntax-table)
  45. ;;(modify-syntax-entry ?\' "\""  autoconf-mode-syntax-table)
  46. (modify-syntax-entry ?#  "<\n" autoconf-mode-syntax-table)
  47. (modify-syntax-entry ?\n ">#"  autoconf-mode-syntax-table)
  48. (modify-syntax-entry ?\( "."   autoconf-mode-syntax-table)
  49. (modify-syntax-entry ?\) "."   autoconf-mode-syntax-table)
  50. (modify-syntax-entry ?\[ "(]"  autoconf-mode-syntax-table)
  51. (modify-syntax-entry ?\] ")["  autoconf-mode-syntax-table)
  52. (modify-syntax-entry ?*  "."   autoconf-mode-syntax-table)
  53. (modify-syntax-entry ?_  "_"   autoconf-mode-syntax-table)
  54.  
  55. (defvar autoconf-mode-map
  56.   (let ((map (make-sparse-keymap)))
  57.     (define-key map "\C-c\C-c" 'comment-region)
  58.     map))
  59.  
  60. ;;;###autoload
  61. (defun autoconf-mode ()
  62.   "A major-mode to edit autoconf input files like configure.in
  63. \\{autoconf-mode-map}
  64. "
  65.   (interactive)
  66.   (kill-all-local-variables)
  67.   (use-local-map autoconf-mode-map)
  68.  
  69.   (make-local-variable 'comment-start)
  70.   (setq comment-start "dnl")
  71.   (make-local-variable 'parse-sexp-ignore-comments)
  72.   (setq parse-sexp-ignore-comments t)
  73.  
  74.   (make-local-variable    'font-lock-defaults)  
  75.   (setq major-mode 'autoconf-mode)
  76.   (setq mode-name "Autoconf")
  77.   (setq font-lock-defaults `(autoconf-font-lock-keywords nil))
  78.   (set-syntax-table autoconf-mode-syntax-table)
  79.   (run-hooks 'autoconf-mode-hook))
  80.  
  81. (provide 'autoconf-mode)
  82.  
  83. ;;; autoconf-mode.el ends here
  84.